<?php
final class LoginController extends ABController{
	protected $s_sessionname = 'ablogging-admin';
	protected $b_persistent = true;
	protected $a_models = array('auth');
	
	function index(){
		$this->error = null;
		echo $this->post('submit');
		if($this->post('submit')){
			$o_Login  = Auth::getInstance();
			if($o_Login->login($this->post('username'),  $this->post('password'))){
				$this->redirect('admin', 'todo');
			}else {
				$this->error=$o_Login->s_lasterror;
			}
		}
		$this->render(true, 'login');
	}
}
?>
